﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MiniFox.Data
{
    /// <summary>
    /// 
    /// </summary>
    public interface IDataCommandAsync
    {
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        Task<int> ExecuteOperationAsync();
        /// <summary>
        /// 
        /// </summary>
        /// <param name="entities"></param>
        /// <returns></returns>
        Task<int> ExecuteOperationAsync(IEnumerable entities);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="entities"></param>
        /// <returns></returns>
        Task<int> ExecuteOperationAsync(params object[] entities);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="dataTable"></param>
        /// <returns></returns>
        Task<int> ExecuteOperationAsync(DataTable dataTable);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        Task<IDictionary<string, object>> ExecuteObjectQueryAsync(object parameters);
        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="parameters"></param>
        /// <returns></returns>
        Task<T> ExecuteObjectQueryAsync<T>(object parameters) where T : class;

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        Task<ResultSet> ExecuteDataQueryAsync();
        /// <summary>
        /// 
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        Task<ResultSet> ExecuteDataQueryAsync(object parameters);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="maxRowCount"></param>
        /// <returns></returns>
        Task<ResultSet> ExecuteDataQueryAsync(int maxRowCount);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="parameters"></param>
        /// <param name="maxRowCount"></param>
        /// <returns></returns>
        Task<ResultSet> ExecuteDataQueryAsync(object parameters, int maxRowCount);

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        Task<ResultSet<T>> ExecuteDataQueryAsync<T>() where T : new();
        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="maxRowCount"></param>
        /// <returns></returns>
        Task<ResultSet<T>> ExecuteDataQueryAsync<T>(int maxRowCount) where T : new();
        /// <summary>
        /// 
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        Task<ResultSet<T>> ExecuteDataQueryAsync<T>(object parameters) where T : new();
        /// <summary>
        /// 
        /// </summary>
        /// <param name="parameters"></param>
        /// <param name="maxRowCount"></param>
        /// <returns></returns>
        Task<ResultSet<T>> ExecuteDataQueryAsync<T>(object parameters, int maxRowCount) where T : new();
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="sortFields"></param>
        /// <returns></returns>
        Task<PagedResultSet> ExecuteDataQueryAsync(int pageIndex, int pageSize, IDictionary<string, bool> sortFields);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="parameters"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="sortFields"></param>
        /// <returns></returns>
        Task<PagedResultSet> ExecuteDataQueryAsync(int pageIndex, int pageSize, IDictionary<string, bool> sortFields, object parameters);
        /// <summary>
        /// s
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="sortFields"></param>
        /// <returns></returns>
        Task<PagedResultSet<T>> ExecuteDataQueryAsync<T>(int pageIndex, int pageSize, IDictionary<string, bool> sortFields) where T : new();
        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="parameters"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="sortFields"></param>
        /// <returns></returns>
        Task<PagedResultSet<T>> ExecuteDataQueryAsync<T>(int pageIndex, int pageSize, IDictionary<string, bool> sortFields, object parameters) where T : new();
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="sortFields"></param>
        /// <returns></returns>
        Task<DataTable> LoadDataTableAsync(int pageIndex, int pageSize, IDictionary<string, bool> sortFields);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="sortFields"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        Task<DataTable> LoadDataTableAsync(int pageIndex, int pageSize, IDictionary<string, bool> sortFields, object parameters);
        /// <summary>
        /// 分页填充数据集
        /// </summary>
        /// <param name="dataTable">要填充的数据集</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页行数</param>
        /// <param name="sortFields">排序字段集</param>
        /// <returns>返回总行数</returns>
        Task<int> FillDataTableAsync(DataTable dataTable, int pageIndex, int pageSize, IDictionary<string, bool> sortFields);
        /// <summary>
        /// 分页填充数据集
        /// </summary>
        /// <param name="dataTable">要填充的数据集</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页行数</param>
        /// <param name="sortFields">排序字段集</param>
        /// <param name="parameters">条件参数</param>
        /// <returns>返回总行数</returns>
        Task<int> FillDataTableAsync(DataTable dataTable, int pageIndex, int pageSize, IDictionary<string, bool> sortFields, object parameters);
    }
}
